package com.yangye.picommon.utils;

import java.io.PrintWriter;
import java.io.StringWriter;

/**
 * @author yangye
 * @date 2019/9/24
 */
public class ThrowableUtil {

	/**
	 * 获取堆栈信息
	 * @param throwable
	 * @return
	 */
	public static String getStackTrace(Throwable throwable){
		StringWriter sw = new StringWriter();
		PrintWriter pw = new PrintWriter(sw);
		try {
			throwable.printStackTrace(pw);
			return sw.toString();
		} finally {
			pw.close();
		}
	}
}
